﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Hammer : Ship
{
    public ParticleSystem m_AddtionalFireTell;
    bool m_IsOpen = false;

    float m_DurationTimeCount = 0;
    public float m_DurationTimeMax = 0.5f;
    public float m_Torque = 1500;
    public Ship HammerHead;
    private new void Start()
    {
        base.Start();
        HammerHead.CollisionDamageMutiple = 2.0f;
    }
    protected new void Update()
    {
        base.Update();
        if (!m_IsOpen)
            return;

        moveForward();
        m_DurationTimeCount += Time.deltaTime;
        if (m_DurationTimeCount > m_DurationTimeMax)
        {
            m_DurationTimeCount = 0;
            m_IsOpen = false;
            m_AddtionalFireTell.Stop();
        }
    }

    public override bool LaunchSkill()
    {
        if (!base.LaunchSkill())
            return false;
        m_IsOpen = true;
        m_AddtionalFireTell.Play();
        AddTorque(-m_Torque);
        AddForce(transform.up, m_Torque);
        SoundsPool.get().PlaySound("Perfabs/Audio/PuShi", transform.position, 90);
        return true;
    }
    public override void OnFight()
    {
        if (SkillIsReady)
            LaunchSkill();
    }
    public override void OnRetreat()
    {
        if (SkillIsReady)
            LaunchSkill();
    }
}
